#@head() 
#@header()
<title>客户列表</title>
#@aside("user")
<div class="content-wrapper">
	<section class="content">
		<div class="row">
			<div class="col-xs-12">
				<div class="box">
					<div class="box-header">
						<h3 class="box-title" style="margin-left: 10px;">客服列表</h3>
						<button id="newclient"
							style="float: right; margin: 0 15px 5px 0; width: 80px;"
							type="button" onclick="location.href='#(path)/client/add'"
							class="btn btn-block btn-info">添加用户</button>
						<div class="box-body">
							<table id="example1" class="table table-striped">
								<thead>
									<tr>
										<th>ID</th>
										<th>姓名</th>
										<th>部门</th>
										<th>电话</th>
										<th>权限</th>
									</tr>
								</thead>
								<tbody>
									#for(item:list.list)
									<tr>
										<td>#(item.id)</td>
										<td>#(item.realname)</td>
										<td>#(item.department)</td>
										<td>#(item.phone)</td>
										<td>
											#if(item.level==0)
											<label class="label label-danger">禁止</label>
											#elseif(item.level==10)
											<label class="label label-success">普通</label>
											#elseif(item.level==30)
											<label class="label label-info">中级</label>
											#elseif(item.level==50)
											<label class="label label-warning">高级</label>
											#else
											<label class="label label-primary">未知</label>
											#end
										</td>  
										<td>
											<a href="#(path)/user/add?id=#(item.id)" class="btn btn-success">编辑</a> 
											<a data-id="#(item.id)" class="btn btn-danger">删除</a>
										</td>
									</tr>
									#end
								</tbody>
							</table>
						</div>
					</div>
				</div>
			</div>
		</div>
	</section>
</div>
#@footer()
<script>
	$(document).ready(function() {
		$(".btn-danger").click(function() {
			var id = $(this).data("id");
			layer.confirm('确认删除？', {btn : [ '确定', '取消' ]}, function() {
				ajax("#(path)/client/del",{"id":id},function(data){
					layer.msg(data.msg, {icon:data.type},function(){
						location.href="#(path)/user/list"
					});
				});
			}, function() {
				layer.msg('已取消', {
					icon : 1
				});
			});
		});
	});
</script>

</body>
</html>

